package team.seekers.catering.common.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.Arrays;

/**
 * 饮食意向枚举
 */
@Getter
public enum EatingWishEnum implements IEnum<Integer> {

    LOSE_WEIGHT(0,  "减脂"),
    MUSCLE_BUILDER(1, "增肌"),
    BALANCE(2,  "均衡饮食");

    private int type;

    private String name;

    EatingWishEnum(int type, String name) {
        this.type = type;
        this.name = name;
    }

    @Override
    public Integer getValue() {
        return this.type;
    }

    public static EatingWishEnum getByType(int type) {
        return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
    }

    public static EatingWishEnum getByName(String name) {
        return Arrays.stream(values()).filter(e -> e.getName().equals(name)).findFirst().orElse(null);
    }
}
